<template>
  <div>
    <div>
      <h2>运营单号：{{ form.orderCode }}</h2>
      <el-form label-width="100px">
        <el-form-item label="填写人">
          <el-input :disabled="true" v-model="form.businessFillingName"/>
        </el-form-item>
        <el-form-item label="用工时间">
          <el-input :disabled="true" v-model="form.workTime"/>
        </el-form-item>
        <el-form-item label="班组">
          <el-input :disabled="true" v-model="form.workGroupName"/>
        </el-form-item>
        <el-form-item label="预计业务量">
          <el-input :disabled="true" v-model="form.predictNumber"/>
        </el-form-item>
        <el-form-item label="启用方案名称">
          <el-input :disabled="true" v-model="form.enableSchemeName"/>
        </el-form-item>
      </el-form>
    </div>
    <div style="max-height: 230px;overflow: auto">
      <div v-for="(historyData, index) in fromData"
           :key="index">
        <h2 >{{ historyData.taskNodeName }}</h2>
        <h3>审批人:{{ historyData.createName }}</h3>
        <h3>审批时间:{{ historyData.createdDate }}</h3>
        <el-form v-for="(fistoryFormData, indexH) in historyData.formHistoryDataDTO" :key="indexH" label-width="80px">
          <el-form-item :label=fistoryFormData.title>
            <el-input v-model="fistoryFormData.value"/>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
import {getOperationalInfo} from "@/api/operation";
import {historyFromData} from '@/api/activiti/historyFormdata'

export default {
  name: "operationalForm",
  props: {
    businessKey: {
      type: String
    }
  },
  data() {
    return {
      // 表单参数
      form: {},
      fromData: [],
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        id: undefined
      }
    }
  },
  created() {
    this.getOperationalInfo()
    this.historyFromData()
  },
  methods: {
    getOperationalInfo() {
      const busKey = this.businessKey.split('_')[1];
      this.queryParams.id = busKey;
      getOperationalInfo(this.queryParams).then(response => {
        this.form = response.rows[0];
      })
    },
    historyFromData() {
      historyFromData(this.businessKey).then(response => {
        this.fromData = response.data
      })
    },
  }
}
</script>

<style scoped>

</style>
